chore: add dart format to pre-commit check and CI - #296
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit Dart formatting step to both the local pre-commit “check” gate (via mise) and CI, so formatting violations fail fast instead of being silently fixed later. Most of the diff is the resulting dart format reflow across tests and Flutter source.
Changes:
- Add a
misetask to format Dart code (dart format .) and include it in thecheckpre-commit gate. - Add a CI step to enforce formatting (
dart format --set-exit-if-changed .) beforeflutter analyze. - Apply formatter-driven reformatting across tests and app code.
Reviewed changes
Copilot reviewed 60 out of 69 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/widgets/overflow_menu_test.dart | Formatter reflow in widget tests. |
| test/widgets/festival_menu_sheets_test.dart | Formatter reflow in widget tests. |
| test/widgets/breadcrumb_bar_test.dart | Formatter reflow in widget tests. |
| test/widgets_test.dart | Formatter reflow in widget tests. |
| test/utils/widget_builders_test.dart | Formatter reflow in utils tests. |
| test/utils/navigation_helpers_test.dart | Formatter reflow in utils tests. |
| test/utils_test.dart | Formatter reflow in utils tests. |
| test/utf8_encoding_test.dart | Formatter reflow in UTF-8 handling tests. |
| test/style_screen_test.dart | Formatter reflow in screen tests. |
| test/style_screen_screenshot_test.dart | Formatter reflow in screenshot tests. |
| test/style_description_helper_test.dart | Formatter reflow in helper tests. |
| test/string_formatting_helper_test.dart | Formatter reflow in helper tests. |
| test/string_comparison_helper_test.dart | Formatter reflow in helper tests. |
| test/storage_service_test.dart | Formatter reflow in service/storage tests. |
| test/services_test.dart | Formatter reflow in services tests. |
| test/screens_test.dart | Formatter reflow in screens tests. |
| test/router_test.dart | Formatter reflow in router tests. |
| test/provider_test.dart | Formatter reflow in provider tests. |
| test/models_test.dart | Formatter reflow in model tests. |
| test/main_test.dart | Formatter reflow in app entry tests. |
| test/info_chip_test.dart | Formatter reflow in widget tests. |
| test/environment_badge_test.dart | Formatter reflow in widget tests. |
| test/drinks_screen_style_filter_test.dart | Formatter reflow in screen/filter tests. |
| test/drink_detail_screen_test.dart | Formatter reflow in screen tests. |
| test/drink_detail_screen_screenshot_test.dart | Formatter reflow in screenshot tests. |
| test/drink_card_test.dart | Formatter reflow in widget tests. |
| test/domain/services/drink_sort_service_test.dart | Formatter reflow in domain service tests. |
| test/domain/services/drink_filter_service_test.dart | Formatter reflow in domain service tests. |
| test/domain/repositories/api_festival_repository_test.dart | Formatter reflow in repository tests. |
| test/brewery_screen_test.dart | Formatter reflow in screen tests. |
| test/beverage_type_helper_test.dart | Formatter reflow in helper tests. |
| test/beer_provider_test.dart | Formatter reflow in provider tests. |
| test/beer_api_service_test.dart | Formatter reflow in API service tests. |
| test/app_theme_test.dart | Formatter reflow in theme tests. |
| test/analytics_service_test.dart | Formatter reflow in analytics tests. |
| test/accessibility_test.dart | Formatter reflow in accessibility tests. |
| mise.toml | Add format task and include it in check. |
| lib/widgets/festival_menu_sheets.dart | Formatter reflow in UI code. |
| lib/widgets/environment_badge.dart | Formatter reflow in widget code. |
| lib/widgets/drink_list_section.dart | Formatter reflow in widget code. |
| lib/widgets/drink_card.dart | Formatter reflow in widget code. |
| lib/utils/url_launcher_helper.dart | Formatter reflow in utility code. |
| lib/utils/style_description_helper.dart | Formatter reflow in utility code. |
| lib/utils/string_comparison_helper.dart | Formatter reflow in utility code/comments. |
| lib/utils/navigation_helpers.dart | Formatter reflow in navigation helper signature. |
| lib/utils/category_color_helper.dart | Formatter reflow in utility code. |
| lib/utils/abv_strength_helper.dart | Formatter reflow in utility code. |
| lib/services/storage_service.dart | Formatter reflow in service code. |
| lib/services/festival_service.dart | Formatter reflow in service code. |
| lib/services/environment_service.dart | Formatter reflow in service code/comments. |
| lib/services/beer_api_service.dart | Formatter reflow in service code. |
| lib/services/analytics_service.dart | Formatter reflow in service code. |
| lib/screens/style_screen.dart | Formatter reflow in screen code. |
| lib/screens/festival_info_screen.dart | Formatter reflow in screen code. |
| lib/screens/drinks_screen.dart | Formatter reflow in screen code. |
| lib/screens/drink_detail_screen.dart | Formatter reflow in screen code. |
| lib/screens/brewery_screen.dart | Formatter reflow in screen code. |
| lib/screens/about_screen.dart | Formatter reflow in screen code. |
| lib/router.dart | Formatter reflow in router config. |
| lib/providers/beer_provider.dart | Formatter reflow in provider code. |
| lib/models/festival.dart | Formatter reflow in model code. |
| lib/models/drink.dart | Formatter reflow in model code. |
| lib/main.dart | Formatter reflow in app entry / widgets. |
| lib/firebase_options.dart | Formatter cleanup (trailing whitespace/newlines). |
| lib/domain/services/drink_filter_service.dart | Formatter reflow in domain service code. |
| lib/constants.dart | Formatter reflow of constant declaration. |
| lib/app_theme.dart | Formatter reflow in theme code. |
| AGENTS.md | Document new format task usage. |
| .github/workflows/ci.yml | Add formatting check step to CI. |
Comment on lines
+68
to
+70
| - name: Check formatting | ||
| run: dart format --set-exit-if-changed . | ||
|
|
Comment on lines
47
to
54
| [tasks.format] | ||
| description = "Format all Dart code in place" | ||
| run = 'dart format .' | ||
|
|
||
| [tasks.check] | ||
| description = "Pre-commit gate: generate → analyze + test (run before every commit)" | ||
| depends = ['analyze', 'test'] | ||
| description = "Pre-commit gate: generate → format + analyze + test (run before every commit)" | ||
| depends = ['format', 'analyze', 'test'] | ||
| run = 'echo "All checks passed"' |
Contributor
LCOV of commit
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Adds a `format` mise task (`dart format .`) and includes it in the `check` pre-commit gate. CI gains a `dart format --set-exit-if-changed .` step before `flutter analyze` so unformatted code is a hard failure on PRs rather than a silent auto-fix. The local task reformats in place; CI uses `--set-exit-if-changed` to fail the build without modifying files.
Bulk-format all Dart files with `dart format .`. No logic changes — line wrapping, trailing whitespace, and indentation only.
Splits the single `format` task into three named sub-tasks: - `dart:format` — dart format . (use --no-deps for speed after Dart changes) - `prettier:format` — Prettier for JS/TS/MJS files - `mise:format` — mise fmt for mise.toml The top-level `format` task now depends on all three. CI check formatting step expanded to cover all three. Prettier added to root package.json; .prettierignore excludes build/, android/, ios/.
- Add --output=none to dart format CI check so it doesn't modify files (--set-exit-if-changed alone still writes) - Remove mise fmt --check from CI: mise is not installed in the CI environment (setup-flutter-app uses subosito/flutter-action directly) - Make dart:format depend on generate so mock files are formatted after codegen, not before
richardthe3rd
force-pushed
the
chore/dart-format
branch
from
May 19, 2026 20:42
ff28482 to
543fcb1
Compare
Contributor
🚀 Cloudflare Pages PreviewYour preview deployment is ready! Preview URL: https://chore-dart-format.staging-cambeerfestival.pages.dev This preview will be automatically updated when you push new commits to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
formatmise task (dart format .) and includes it in thecheckpre-commit gate. CI gains adart format --set-exit-if-changed .step before
flutter analyzeso unformatted code is a hard failure onPRs rather than a silent auto-fix.
The local task reformats in place; CI uses
--set-exit-if-changedtofail the build without modifying files.